package com.wonderful.mall.seckill.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 开启定时任务
 * 1 @EnableScheduling
 * 2 @Scheduled(cron = "* * * * * *")
 * 3 @EnableAsync
 * 4 @Async
 */
@EnableScheduling
@Component
@Slf4j
@EnableAsync
public class HelloSchedule {
//    @Scheduled(cron = "* * * ? * 1")
//    @Async
//    public void hello() throws InterruptedException {
//        log.info("hello\n");
//        Thread.sleep(3000);
//    }
}
